<?php
/**
 * Description
 *
 * PHP version 7
 *
 * @category Custom
 * @package  Custom
 * @author   ryu <mo5467@126.com>
 * @date     2020-04-28 00:14:56
 * @lastTime 2020-05-01 23:09:30
 * @license  https://opensource.org/licenses/MIT MIT License
 * @link     none
 */
namespace Design\Behavioral\Command;

class Receiver
{

    private $enableDate = false;

    private $output = [];


    public function write(string $message)
    {
        if ($this->enableDate === true) {
            $message .= ' ['.date('Y-m-d').']';
        }

        $this->output[] = $message;

    }//end write()


    public function getOutput() : string
    {
        return join("\n", $this->output);

    }//end getOutput()


    public function enableDate()
    {
        $this->enableDate = true;

    }//end enableDate()


    public function disableDate()
    {
        $this->enableDate = false;

    }//end disableDate()


}//end class
